package springcloud.feign.fallback;

import springcloud.feign.AddressOpenfeign;
import springcloud.pojo.Address;

/**
 * @Author 咕唧
 * @Date 2022/6/25 19:44
 * @Version 1.0
 * fallback 指向当前接口的一个实现类,因为是实现类,所以具有和解决一样的方法,那么当我调用哪个方法失败的时候就可以直接调用实现类的对应方法
 */
//@Component
public class AddressOpenfeignFallBack implements AddressOpenfeign {
    @Override
    public Address findById(Long id) {
        Address address = new Address();
        address.setId(-100L);
        address.setAddressName("这是findById降级返回的数据");
        return address;
    }

    @Override
    public Address test(Long id) {
        Address address = new Address();
        address.setId(-100L);
        address.setAddressName("这是test降级返回的数据");
        return address;
    }

    @Override
    public String test2(String name) {
        return "test2的降级数据";
    }

    @Override
    public String test3(String name, int age) {
        return "test3的降级数据";
    }

    @Override
    public Address test4(Address address) {
        address.setId(-100L);
        address.setAddressName("这是test4降级返回的数据");
        return address;
    }
}
